home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 September
/
PCWorld_2006-09_cd.bin
/
v cisle
/
hexer
/
mpth_17.exe
/
{app}
/
scripts
/
XOR Data.mps
< prev
Wrap
Text File
|
2005-05-22
|
1KB
|
52 lines
INCLUDE '*.lng'
= xor a file's contents
option globalvars 1
var start dword count dword xval qword editorf file val qword oldpos dword rest dword
editorf = fileopen('::current', 'rw')
number_radix = 10
number_prefix = ''
number_suffix = ''
start = dword(input(__XD1__,__XD2__,text(filegetprop(editorf, 'selstart'))))
if filegetprop(editorf, 'selcount') == 0
count = filesize(editorf) - start
else
count = filegetprop(editorf, 'selcount')
endif
count = dword(input(__XD1__, __XD3__, Text(count)))
xval = qword(input(__XD1__,__XD4__,'255'))
if xval > 0:= qword is signed
if xval < 256:inc xval (xval << 8):endif
if xval < 0x10000:inc xval (xval << 16):endif
if xval < 0x100000000:inc xval (xval << 32):endif
endif
fileseek editorf start
loop schleife (count / 8)
rest = count mod 8
if rest != 0
val = 0
oldpos = filepos(editorf)
count=fileread(editorf, @val):= use in function context to avoid short read error
fileseek editorf oldpos
filewrite editorf textcopy(data2text(qword(val xor xval)),1, rest)
endif
showprogress 100, 100
fileclose editorf
end
@@schleife
oldpos = filepos(editorf)
fileread editorf val
fileseek editorf oldpos
val = val xor xval
filewrite editorf val
showprogress count+start, filepos(editorf)-start
return